//
//  AppDelegate.m
//  CloudAtCostPanel
//
//  Created by leonardo on 2017/1/25.
//  Copyright © 2017年 tanpengsccd. All rights reserved.
//

#import "AppDelegate.h"

#import "TPRootViewController.h"

#import "TPUIMacro.h"

#import "TPLogFormater.h"
//#import "TPServersNavController.h"
//#import "TPCloudProNavViewController.h"
//#import "TPAccoutNavViewController.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    
    self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
   
    
//    //Servers 服务器状态
//    
//    TPServersNavController * serversNavC = [TPServersNavController new];
//    
//    //CloudPro 服务器操作
//    TPCloudProNavViewController * cloudProNavC = [TPCloudProNavViewController new];
//    
//    // 其他
//    
//    
//    //Account 账户
//    TPAccoutNavViewController * accoutNavC = [TPAccoutNavViewController new];
//    
    
    //tabbarC主界面
//    TPTabBarController * tabbarC = [[TPTabBarController alloc]init];
//    tabbarC.viewControllers = @[serversNavC,
//                                cloudProNavC ,
//                                accoutNavC
//                                ];
    
    TPRootViewController * rootVC = [TPRootViewController new];
    self.window.rootViewController = rootVC;
    [self.window makeKeyAndVisible];
    
    
    
    //DDLog 这是DDLog 框架，可以彩色输出 控制台信息。移除不影响
    // Enable XcodeColors
    setenv("XcodeColors", "YES", 0);
    [DDLog addLogger:[DDTTYLogger sharedInstance]]; // TTY = Xcode console
    [[DDTTYLogger sharedInstance] setColorsEnabled:YES];
    [[DDTTYLogger sharedInstance] setLogFormatter:[TPLogFormater new]];
    //#define DDLogInfo NSLog
    //#define DDLogVerbose NSLog
    //#define DDLogDebug NSLog
    //#define DDLogWarn NSLog
    //#define DDLogError NSLog
    [[DDTTYLogger sharedInstance]setForegroundColor:COLOUR_GREEN backgroundColor:nil forFlag:DDLogFlagDebug];
    [[DDTTYLogger sharedInstance]setForegroundColor:COLOUR_ORANGE backgroundColor:nil forFlag:DDLogFlagWarning];
    [[DDTTYLogger sharedInstance]setForegroundColor:COLOUR_RED backgroundColor:nil forFlag:DDLogFlagError];
    [[DDTTYLogger sharedInstance]setForegroundColor:COLOUR_GREEN backgroundColor:nil forFlag:DDLogFlagDebug];
    
    
    //    [DDLog addLogger:[DDASLLogger sharedInstance]]; // ASL = Apple System Logs
    //
    //    DDFileLogger *fileLogger = [[DDFileLogger alloc] init]; // File Logger
    //    fileLogger.rollingFrequency = 60 * 60 * 24; // 24 hour rolling
    //    fileLogger.logFileManager.maximumNumberOfLogFiles = 7;
    //    [DDLog addLogger:fileLogger];
    //
    ////    ...
    
    //    DDLogVerbose(@"Verbose");
    //    DDLogDebug(@"Debug");
    //    DDLogInfo(@"Info");
    //    DDLogWarn(@"Warn");
    //    DDLogError(@"Error");
    
    
    
    return YES;
}


- (void)applicationWillResignActive:(UIApplication *)application {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}


- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}


- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}


- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}


- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}


@end
